home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Programming / Complete Applications / Screen Savers / ZoomIdle (C) / ZoomIdle.doc < prev    next >
Encoding:
Text File  |  1986-07-31  |  3.0 KB  |  55 lines  |  [TEXT/ttxt]

  1. /* Written  9:30 am  Jul 26, 1986 by dubois@uwmacc.UUCP in uiucdcsb:mod.mac.sources */
  2. ZoomIdle Commentary
  3.  
  4. There are some assumptions inherent in the code.  These are not
  5. always explicitly documented; I discuss them here.  This discussion
  6. applies both to the Rascal and the LightspeedC source versions.
  7.  
  8. When ZoomIdle is opened, a window is put up over the screen.  The
  9. portRect of the Window Manager port is used so it will work for a
  10. screen of any size.  The visRgn of the port must be set to the entire
  11. screen or drawing will only take place below the menu bar.  Then
  12. ZoomIdle waits.
  13.  
  14. Two event types are processed:  activate and mouse down.  accRun
  15. messages are also processed.  (accRun code chooses a rectangle randomly
  16. and zooms to it; that code is not triggered until an activate event for
  17. the window is received.)  Since the Event Manager reports window
  18. deactivation before window activation, we know, when the activate event
  19. arrives, that the previous active window (whatever it was) has been
  20. deactivated and its owner did whatever was necessary to respond to
  21. that.  ZoomIdle clears the menu bar to prevent the main application
  22. from allowing menu item selection, paints the screen black, and sets
  23. the state so that zooming begins (i.e., so that accRun messages aren't
  24. ignored).
  25.  
  26. Mouse clicks in the menu bar are not reported to ZoomIdle, because
  27. applications typically pass the click to MenuSelect to track the mouse
  28. until the button is released.  With the menu bar cleared, MenuSelect
  29. just waits until the mouse button is released.  The effect is simply to
  30. pause the display while the button is down.  (In particular, ZoomIdle
  31. can't be selected again; that's why there isn't any check in the code
  32. to see if the driver is already open.  Normally, it's dangerous not to
  33. make this check.)
  34.  
  35. Mouse clicks below the menu bar are reported to ZoomIdle, and cause
  36. termination.  The window is destroyed and the menu bar is restored.
  37. Note that there is no check to see if the menu bar actually needs
  38. restoring.  It is reasonable to ask whether this is valid.  For
  39. instance, if the user clicks the mouse after initiating ZoomIdle but
  40. before the window comes active, will there be any menu bar to restore?
  41. Yes, because ZoomIdle takes advantage of the fact that the perceptual
  42. mechanisms of the Macintosh operating system induce a distortion of
  43. temporal reality; events are not reported in chronological order but in
  44. priority order.  Since activates are higher priority than mouse clicks,
  45. no matter when the user clicks the mouse, ZoomIdle can never become
  46. conscious of the click until after the activate event is received.
  47. Hence, it *must* be true that the menu bar needs restoring when the
  48. mouse click handling code is invoked.
  49.  
  50. The drawing pattern and mode for zooming are set to gray and patXor,
  51. respectively.  ZoomIdle builds its own gray pattern because, as a DA,
  52. it doesn't access off A5.  I don't know what that means, except that
  53. the normal QuickDraw globals can't be used.
  54. /* End of text from uiucdcsb:mod.mac.sources */
  55.